﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}


<script src="~/lib/layui/layui.js"></script>
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />

<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet">
</head>
<body>
    <div class="layui-btn-container">
        <button type="button" class="layui-btn layui-btn-radius layui-bg-red" lay-on="test-iframe-cura" onclick="adddata()">新增</button>
    </div>
    <div>

        <table class="layui-hide" id="ID-table-demo-data"></table>
    </div>



    <!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
    <script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>

    <script type="text/html" id="toolDemo">
        <div class="layui-clear-space">
          <a onclick="Update()" lay-on="test-iframe-curs"  style="color:cornflowerblue">修改</a>
        </div>
    </script>

    <script>


        var hkid = "";
        //就绪函数
        $(function () {

             hkid = location.href.split("=")[1];
            StashHtml()
        })

        //仓库显示
        function StashHtml() {

          
            $.ajax({

                url: '@ViewBag.FoundationRead' + "/api/Production/SchedulingDisplay",
                data: JSON.stringify({ productionid: hkid }),
                type: "post",
                async: false,
                dataType: "json",
                contentType: "application/json",
                success: res => {

                    console.log(res,'77777777')
                    layui.use('table', function () {
                        var table = layui.table;

                        // 已知数据渲染
                        var inst = table.render({
                            elem: '#ID-table-demo-data',
                            toolbar: '#toolbarDemo',
                            cols: [[ //标题栏
                                { type: 'checkbox', title: '复选框', fixed: true }, // 单选框
                                { field: 'quantityProduced', title: '任务编号', width: 200 },
                                { field: 'processname', title: '任务名称', width: 200 },
                                { field: 'taskNumber', title: '工作站编号', width: 200 },
                                { field: 'productionname', title: '工作站名称', width: 200 },
                                { field: 'productionnum', title: '排产数量', width: 200 },
                                { field: 'processinstructions', title: '已生产数量', width: 200 },
                                { field: 'startTime', title: '开始生产时间', width: 200 },
                                { field: 'productionTime', title: '生产时长', width: 200 },
                                { field: 'finshTime', title: '预计完成时间', width: 200 },
                                { fixed: 'right', title: '操作', width: 134, minWidth: 125, templet: '#toolDemo' }
                            ]],
                            data: res.data,
                            //skin: 'line', // 表格风格
                            //even: true,
                            page: true, // 是否显示分页
                            limits: [5, 10, 15],
                            limit: 5 // 每页默认显示的数量
                        });
                    });
                }

            })





        }



        var $ = layui.$;
        var table = layui.table
        var layer = layui.layer;
        var util = layui.util;
        // 事件
        util.on('lay-on', {

            'test-iframe-curl': function () {
                layer.open({
                    type: 2,
                    title: '增加工序',
                    shadeClose: true,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['900px', '600px'],
                    content: '/Document/ProcessAdds'
                });
            }
        })



        // 事件
        util.on('lay-on', {

            'test-iframe-cur': function () {
                layer.open({
                    type: 2,
                    title: '增加工序',
                    shadeClose: true,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['900px', '600px'],
                    content: '/Document/ProcessAdds'
                });
            }
        })


        var getid = 0;

        // 触发表格复选框选择
        table.on('checkbox(ID-table-demo-data)', function (obj) {
            getid = obj.data.productionid
           
        });

        function Update() {



            var $ = layui.$;
            var table = layui.table
            var layer = layui.layer;
            var util = layui.util;
            // 事件
            util.on('lay-on', {

                'test-iframe-curs': function () {
                    layer.open({
                        type: 2,
                        title: '生产任务修改',
                        shadeClose: true,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['900px', '600px'],
                        content: '/Document/ProductionTaskModification?id=' + getid
                    });
                }
            })





        }




        function adddata() { 
          
            var $ = layui.$;
            var table = layui.table
                    var layer = layui.layer;
            var util = layui.util;
            // 事件
            util.on('lay-on', {

                'test-iframe-cura': function () {
                    layer.open({
                        type: 2,
                        title: '新增',
                        shadeClose: true,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['900px', '800px'],
                        content: '/Document/ProductionTaskhtml?id=' + hkid
                    });
                }
            })
        
        }



    </script>




</body>
</html>


